package com.springboot.husha.controller.app;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.springboot.husha.entity.Lunbotu;
import com.springboot.husha.qpage.QPage;
import com.springboot.husha.service.ILunbotuService;
import com.springboot.husha.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 * 轮播图 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-02-28
 */
@Controller
@RequestMapping("/api/front/lunbotu")
public class AppLunbotuController {

    /**
     * 路由地址
     */
    public String prefix = "/view/front/lunbotu";

    /**
     * 业务层
     */
    @Autowired
    private ILunbotuService service;

    /**
     * 进入管理页面
     * @return
     */
    @RequestMapping("/index")
    public String index(){
        return prefix+"/index";
    }


    /**
     * 获取所有的列表
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public Result getList(QPage qPage, Lunbotu obj) {
        QueryWrapper<Lunbotu> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("type",obj.getType());
        List<Lunbotu> lunbotuList=this.service.list(queryWrapper);
        return Result.reOk("查询成功",lunbotuList);
    }



}
